<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
%>
<html>
<head>
    <title>书列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="<%=path%>/bootstrap/css/bootstrap.min.css">
    <script src="<%=path%>/bootstrap/js/jquery.min.js"></script>
    <script src="<%=path%>/bootstrap/js/bootstrap.min.js"></script>
    <script src="<%=path%>/js/common.js"></script>
</head>
<body>
<jsp:include page="/common/header.jsp"/>
<div id="main_div">
    <a class="key" href="<%=path%>/pages/book/addBook.jsp">新增</a>
</div>
<table class="table table-striped">
    <thead>
    <tr>
        <th class="text-center">序号</th>
        <th class="text-center">书名</th>
        <th class="text-center">编码</th>
        <th class="text-center">价格</th>
        <th class="text-center">描述</th>
        <th class="text-center">操作</th>
    </tr>
    </thead>
    <tbody>
    <c:if test="${!empty bookList}">
        <c:forEach var="book" items="${bookList}" varStatus="var">
            <tr>
                <td class="text-center">${var.index+1}</td>
                <td class="text-center">${book.bookName}</td>
                <td class="text-center">${book.bookCode}</td>
                <td class="text-center">${book.bookPrice}</td>
                <td class="text-center">${book.bookDescription}</td>
                <td class="text-center">
                    <a href="javascript:void(0)" onclick="deleteBook(${book.id})">删除</a>
                    <a href="javascript:void(0)" onclick="editBook(${book.id})">修改</a>
                </td>
            </tr>
        </c:forEach>
    </c:if>
    </tbody>

</table>
</body>
</html>
<script>
    function deleteBook(bookId) {
        alert("点击了删除："+bookId)
    }

    function editBook(bookId) {
        alert("点击了修改："+bookId)
    }
</script>